package com.rework.joss.ztree.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.rework.joss.ztree.TreeNode;
import com.rework.joss.ztree.base.BaseController;
import com.rework.joss.ztree.service.SysTreeService;

@Controller
@RequestMapping("/test/ztree")
public class SysTreeController extends BaseController {
	@Autowired
	private SysTreeService sysTreeService;

	@RequestMapping("/nochild")
	public void userList(HttpServletRequest request, HttpServletResponse response) throws Exception{
		TreeNode treeNode = sysTreeService.getUserTree();
		sendJsonMessage(response, treeNode);
	}
	
	@RequestMapping("/haschild")
	public void nodeList(HttpServletRequest request, HttpServletResponse response) throws Exception{
		TreeNode treeNode = sysTreeService.getNodeTree();
		sendJsonMessage(response, treeNode);
	}
}
